package com.skt.domain.VO;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * 布隆过滤器统计信息VO
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BloomFilterStatsVO {
    private String name;
    private long expectedInsertions;
    private long actualInsertions;
    private double falseProbability;
    private double expectedFalsePositiveRate;
    private LocalDateTime lastUpdateTime;
    private boolean isSaturated;
    
    // 计算当前误判率
    public double getCurrentFalsePositiveRate() {
        if (actualInsertions == 0) return 0.0;
        return Math.pow(1 - Math.exp(-actualInsertions / (double) expectedInsertions), actualInsertions);
    }
}